<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head>
<title></title>
  <style type="text/css">
    <!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
  </style>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head><body bgcolor="#ffffff">


<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = -->
<!-- =   Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard  markus@jave.de   = -->
<!-- =     Further information: http://www.java2html.de     = -->
<div align="left" class="java">
<table border="0" cellpadding="3" cellspacing="0" bgcolor="#ffffff">
   <tr>
  <!-- start source code -->
   <td nowrap="nowrap" valign="top" align="left">
    <code>
<font color="#7f0055"><b>package&nbsp;</b></font><font color="#000000">interfaces.graficos;</font><br />
<font color="#ffffff"></font><br />
<font color="#7f0055"><b>import&nbsp;</b></font><font color="#000000">java.awt.image.*;</font><br />
<font color="#7f0055"><b>import&nbsp;</b></font><font color="#000000">java.util.ArrayList;</font><br />
<font color="#ffffff"></font><br />
<font color="#7f0055"><b>import&nbsp;</b></font><font color="#000000">java.util.ResourceBundle;</font><br />
<font color="#7f0055"><b>import&nbsp;</b></font><font color="#000000">org.jfree.chart.ChartFactory;</font><br />
<font color="#7f0055"><b>import&nbsp;</b></font><font color="#000000">org.jfree.chart.JFreeChart;</font><br />
<font color="#7f0055"><b>import&nbsp;</b></font><font color="#000000">org.jfree.data.general.DefaultPieDataset;</font><br />
<font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*&nbsp;Clase&nbsp;que&nbsp;genera&nbsp;graficos&nbsp;de&nbsp;sectores</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@author&nbsp;</font><font color="#3f5fbf">Jos&eacute;&nbsp;Mar&iacute;a&nbsp;Mart&iacute;n&nbsp;Bl&aacute;zquez</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*</font><br />
<font color="#ffffff">&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#7f0055"><b>public&nbsp;class&nbsp;</b></font><font color="#000000">PieChart&nbsp;</font><font color="#7f0055"><b>extends&nbsp;</b></font><font color="#000000">Chart</font><font color="#000000">{</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Constructor&nbsp;de&nbsp;la&nbsp;clase</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#000000">PieChart</font><font color="#000000">(</font><font color="#000000">ArrayList&lt;String&gt;&nbsp;fechas,ArrayList&lt;Double&gt;&nbsp;cantidades,&nbsp;ResourceBundle&nbsp;bundle</font><font color="#000000">){</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>super</b></font><font color="#000000">(</font><font color="#000000">fechas,cantidades,&nbsp;bundle</font><font color="#000000">)</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;Metodo&nbsp;que&nbsp;crea&nbsp;el&nbsp;grafico</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;</font><font color="#7f9fbf">@return&nbsp;</font><font color="#3f5fbf">imagen&nbsp;en&nbsp;formato&nbsp;BufferedImage</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><b>public&nbsp;</b></font><font color="#000000">BufferedImage&nbsp;creaImagen</font><font color="#000000">()</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">DefaultPieDataset&nbsp;pieDataset&nbsp;=&nbsp;</font><font color="#7f0055"><b>new&nbsp;</b></font><font color="#000000">DefaultPieDataset</font><font color="#000000">()</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>for</b></font><font color="#000000">(</font><font color="#7f0055"><b>int&nbsp;</b></font><font color="#000000">i=</font><font color="#990000">0</font><font color="#000000">;i&lt;fechas.size</font><font color="#000000">()</font><font color="#000000">;i++</font><font color="#000000">){</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">pieDataset.setValue</font><font color="#000000">(</font><font color="#000000">fechas.get</font><font color="#000000">(</font><font color="#000000">i</font><font color="#000000">)</font><font color="#000000">,cantidades.get</font><font color="#000000">(</font><font color="#000000">i</font><font color="#000000">))</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">JFreeChart&nbsp;chart&nbsp;=&nbsp;ChartFactory.createPieChart</font><font color="#000000">(</font><font color="#000000">bundle.getString</font><font color="#000000">(</font><font color="#2a00ff">&#34;I07_ventas_realizadas&#34;</font><font color="#000000">)</font><font color="#000000">,</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">pieDataset,&nbsp;true,&nbsp;true,&nbsp;</font><font color="#7f0055"><b>false</b></font><font color="#000000">)</font><font color="#000000">;</font><br />
<font color="#ffffff"></font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">BufferedImage&nbsp;image&nbsp;=&nbsp;chart.createBufferedImage</font><font color="#000000">(</font><font color="#990000">700</font><font color="#000000">,</font><font color="#990000">700</font><font color="#000000">)</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>return&nbsp;</b></font><font color="#000000">image;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}&nbsp;&nbsp;</font><br />
<font color="#000000">}</font></code>
    
   </td>
  <!-- end source code -->
   </tr>
</table>
</div>
<!-- =       END of automatically generated HTML code       = -->
<!-- ======================================================== -->


</body></html>